//
//  CellOfFilm.m
//  UI13_xib创建自定义Cell
//
//  Created by wyx on 16/3/25.
//  Copyright © 2016年 Apon. All rights reserved.
//

#import "CellOfFilm.h"
#import "ModelOfBeef.h"
#pragma mark - 声明
@interface CellOfFilm()

@property (retain, nonatomic) IBOutlet UIView *viewOfBack;
@property (retain, nonatomic) IBOutlet UIView *viewOflittle;
/** 感兴趣人数 */
@property (retain, nonatomic) IBOutlet UILabel *Num1;
/** 参加人数 */
@property (retain, nonatomic) IBOutlet UILabel *Num2;
/** 标题 */
@property (retain, nonatomic) IBOutlet UILabel *title;
/** 时间 */
@property (retain, nonatomic) IBOutlet UILabel *labelOfTime;
/** 地点 */
@property (retain, nonatomic) IBOutlet UILabel *labelOfLoc;
/** 类型 */
@property (retain, nonatomic) IBOutlet UILabel *labelOfStyle;
/** 图片 */
@property (retain, nonatomic) IBOutlet UIImageView *image;

@end

@implementation CellOfFilm
#pragma mark - 属性
- (void)awakeFromNib {
    // Initialization code
    //圆边
    self.viewOfBack.layer.cornerRadius = 10;
    self.viewOflittle.layer.cornerRadius = 7;
    self.viewOfBack.backgroundColor = [UIColor colorWithRed:224/255.f green:235/255.f blue:240/255.f alpha:1];
    self.image.layer.cornerRadius = 10;
    //阴影
    self.viewOflittle.layer.shadowOpacity = 0.5;
    //阴影颜色
    self.viewOflittle.layer.shadowColor = [UIColor blackColor].CGColor;
    //偏移量
    self.viewOfBack.layer.shadowOffset = CGSizeMake(0, 0);
    self.viewOfBack.layer.shadowRadius = 0;
    //self.viewOfBack.layer.shadowPath//贝塞尔曲线路径
    [self.Num1 setTextColor:[UIColor redColor]];
    [self.Num2 setTextColor:[UIColor redColor]];
}
#pragma mark - 子视图赋值
-(void)setCellContentValue:(ModelOfBeef *)model{
    NSURL *imageUrl = [NSURL URLWithString:model.image];
    UIImage *imageOfBeef = [UIImage imageWithData:[NSData dataWithContentsOfURL:imageUrl]];
    self.image.image = imageOfBeef;
    
    
    self.title.text = model.title;
    self.labelOfTime.text = model.begin_time;
    NSString *str1 = @"地点:";
    self.labelOfLoc.text = [str1 stringByAppendingString: model.loc_name];
    NSString *str3 = @"类型:";
    self.labelOfStyle.text = [str3 stringByAppendingString:model.subcategory_name];
    
    self.Num1.text = [NSString stringWithFormat:@"%ld",model.participant_count];
    self.Num2.text = [NSString stringWithFormat:@"%ld",model.wisher_count];
    
    
    
    
    
    [str1 release];
    //[str2 release];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (void)dealloc {
    [_viewOfBack release];
    [_viewOflittle release];
    [_Num1 release];
    [_Num2 release];
    [_title release];
    [_labelOfTime release];
    [_labelOfLoc release];
    [_labelOfStyle release];
    [_image release];
    [super dealloc];
}
@end
